from demo.settings import ADMINLTE3_THEME, PROJECT_TITLE, CHART_TITLE_1, CHART_TITLE_2, CHART_TITLE_3

def dynamic_config_loader(request):
    """动态加载系统配置，包括主题、项目标题和数据图表标题等"""
    # 优先从会话中获取主题设置，如果不存在则使用settings中的默认值
    theme = request.session.get('adminlte_theme', ADMINLTE3_THEME)
    return {
        'ADMINLTE3_THEME': theme,
        'PROJECT_TITLE': PROJECT_TITLE,
        'CHART_TITLE_1': CHART_TITLE_1,
        'CHART_TITLE_2': CHART_TITLE_2,
        'CHART_TITLE_3': CHART_TITLE_3,
    }